package com.lwx.chapter11;

public class PutZero {
    public void zero(int[][] m){
        for (int i = 0; i < m.length; i++) {
            for (int j = 0; j < m[i].length; j++) {
                if(m[i][j] == 0){
                    putZeroAtIndex(i, j, m);
                }
            }
        }
    }
    //将第a行和第b列的元素设置为0
    public void putZeroAtIndex(int a, int b,int[][]m){
        for (int i = 0; i < m.length; i++) {
            //第
            if(i == a){
                for (int j = 0; j < m[i].length; j++) {
                    m[i][j] = 0;
                }
            }

        }
    }
}
